<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>搜索结果</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            text-decoration: none;
            list-style: none;
            position: relative;
            font-family: 微软雅黑;
            overflow: visible;
            height: 250px;
        }
        #top {
            background-color: #F0F3F5;
            height: 110px;
            width: 100%;
        }
        #daohang {
            height: 30px;
            background: #545652;
        }
        #search {
            height: 70px;
        }
        #search_text {
            position: absolute;
            left: 40%;
            top: 20px;
            width: 30%;
            height: 32px;
            padding-left: 10px;
            border-top-left-radius: 5px;
            border-bottom-left-radius: 5px;
            border: none;
            box-shadow: 2px 2px 1px #888888;
        }
        #search_button {
            position: absolute;
            left: 70%;
            top: 20px;
            width: 37px;
            height: 34px;
            font-size: 0;
            cursor: pointer;
            background: url(search.png)no-repeat;
            background-color: #9099A1;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
            border: none;
        }
        #daohang>a {
            color: #D5D5D5;
            line-height: 30px;
            left: 15px;
            margin: 8px;
        }
        #middle{
            height: 100px;

            display: flex;
        }
        #foot{
            height: 1000px;
            display: flex;

        }
        #left{
            width: 70%;
            height: 100%;
			left: 15%;
        }
        #select_movie{

            left: 10%;
        }
        #search_value{
            left: 5%;
        }
		#gohome{
			color: #D5D5D5;
			float: right;
			right: 30px;
			top: 4px;
		}
		#gohome:hover{
			color: white;
		}
    </style>
    <script type="text/javascript" src="ejs.min.js"></script>
</head>
<body>
<div id="top">

    <div id="daohang">
        <form action="" id="biaodan1">
        <a href="../zzy/homepage.html" id="gohome">回到主页</a>
        </form>
      </div>
    <div id="search">
        <form action="../zgp/find4yfj.html" method="get" id="select_movies_form">
            <a href="../zzy/homepage.html" style="left: 25%;top: 20px;font-size: 25px;color: #007722;">酷睿影评</a>
            <input type="text" name="movie_name" id="search_text" placeholder="您想搜索的电影名" maxlength="60">
            <input type="submit" value="搜索" name="submit" id="search_button" />
        </form>
      </div>

</div>
<div id="middle">
<h1 id="search_value" style="left: 25%;">

</h1>
</div>

<div id="foot">
    <div id="left">
        <div id="select_movie" >
			
		</div>
    </div>

</div>

<script id="temp4FindMovie" type="text/template">
    <%  for(var i in find_movie) {%>
     <div class="comment" style="height: ;">
         <div style="float: left">
       <a href="../yfj/detail.html?id=<%=find_movie[i].movie_id%>">
         <img  src="<%=find_movie[i].movie_cover%>" style="width: 190px;height: 300px;" ></a></div>
         <div style="float: left;width: 70%;left: 50px;">
         &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>片名：</strong></span><span><%=find_movie[i].movie_name%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>导演：</strong></span><span><%=find_movie[i].movie_director%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>编剧：</strong></span><span><%=find_movie[i].movie_writer%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>主演：</strong></span><span><%=find_movie[i].movie_actor%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>类型：</strong></span><span><%=find_movie[i].movie_type%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>地区：</strong></span><span><%=find_movie[i].movie_region%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>语言：</strong></span><span><%=find_movie[i].movie_lang%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>上映日期：</strong></span><span><%=timestampToTime(find_movie[i].movie_date)%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>集数：</strong></span><span><%=find_movie[i].jishu%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>片长：</strong></span><span><%=find_movie[i].movie_length%></span><br>
             &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span><strong>别名：</strong></span><span><%=find_movie[i].movie_alias%></span><br>
     
     </div>
     </div><br><br><br><br><br>
    <%  }  %>
</script>

<script type="text/javascript">
	function get_args() {
		var obj = {};
		decodeURI(window.location.search).substring(1).split('&').map(el => el.split('=')).map(el => obj[el[0]] = el[1])
		return obj;
	}
	
	function timestampToTime(timestamp)
	// 这里是一个将时间戳转换成正常时间格式的方法
	{
		var date = new Date(timestamp);
		//时间戳为10位需*1000，时间戳为13位的话不需乘1000
		var Y = date.getFullYear() + '-';
		var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
		var D = date.getDate() + ' ';
		return Y + M + D;
	}
</script>



<script>
    //根据电影名查找电影详情
	window.onload=findMovie();
    function findMovie(){
		var movie_name = get_args()["movie_name"];
		var aaa=document.getElementById('search_value');
		aaa.innerHTML='搜索 '+movie_name;
        var data = null;
		// debugger;
		fetch('/CoolReal/moviebyname?movie_name='+get_args()['movie_name'])
		
		.then(function(res) {
			return res.json();
		}).then(function(data) {
			if (!data) {
				return;
			}
			var temp4FindMovie = document.getElementById('temp4FindMovie');
			var html = ejs.render(temp4FindMovie.innerHTML, {find_movie: data});
			var select_movie = document.getElementById('select_movie');
			select_movie.innerHTML = html;
			});
			}
</script>


</body>
</html>

<!-- <%=timestampToTime(find_movie[i].movie_date)%> -->